package com.lxh.student.controller;

import com.lxh.student.entity.ResponseResult;
import com.lxh.student.entity.Teacher;
import com.lxh.student.service.TeacherService;
import com.lxh.student.service.impl.TeacherServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/teachers")
public class TeacherController {

    @Autowired
    @Qualifier("teacherLoginServiceImpl")
    private TeacherService teacherService;

    @PostMapping("/login")
    public ResponseResult teacherLogin(@RequestBody Teacher teacher){
        log.info("TeacherController_getTeacher");
        return teacherService.findOne(teacher);
    }

    @PostMapping("/logout")
    public ResponseResult teacherLogout(){
        log.info("TeacherController_getTeacher");
        return teacherService.logout();
    }


}
